<html><head><title>ReceiveHTTPFile</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="4">ReceiveHTTPFile()</font></b></p>
<p><b>Syntax</b></p><blockquote>
Result = <font color="#3A3966"><b>ReceiveHTTPFile</b></font>(URL$, Filename$ [, Flags])</blockquote>

</blockquote>
<b>Description</b><br><blockquote>

Download a file to disk from the given URL$. 

</blockquote><p><b>Parameters</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>URL$</i></td>
<td width="90%"> 
The URL to download from. 

</td></tr>
<tr><td><i>Filename$</i></td>
<td> 
The local filename to write the file to. If the filename does not include a full path, it 
is interpreted relative to the <a href="../filesystem/getcurrentdirectory.html">current directory</a>. 
If the file exists, it will be overwritten. 

</td></tr>
<tr><td><i>Flags (optional)</i></td>
<td> 
It can be a combination of the following value: 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_HTTP_Asynchronous</font>: starts the download asynchronously.
  <font color="#924B72">#PB_HTTP_NoRedirect</font>  : don't follow automatic redirections.
</font></pre>

</td></tr>
</table>
</blockquote><p><b>Return value</b></p><blockquote>

Returns nonzero if the download was successful, zero otherwise. If <font color="#924B72">#PB_HTTP_Asynchronous</font> 
was specified, it returns the 'HttpConnection' value needed for <a href="httpprogress.html">HTTPProgress()</a>, 
<a href="aborthttp.html">AbortHTTP()</a> and <a href="finishhttp.html">FinishHTTP()</a>. 

</blockquote><p><b>Remarks</b></p><blockquote>

<a href="../network/initnetwork.html">InitNetwork()</a> has to be called before using this command. 

</blockquote><p><b>Example</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2"><font color="#3A3966">  InitNetwork</font>()

  Filename$ =<font color="#3A3966"> SaveFileRequester</font>(&quot;Where to save index.php ?&quot;, &quot;&quot;, &quot;&quot;, 0)

  <b><font color="#3A3966">If</font></b> <font color="#3A3966">ReceiveHTTPFile</font>(&quot;http://www.purebasic.com/index.php&quot;, Filename$)
    <b><font color="#3A3966">Debug</font></b> &quot;Success&quot;
  <b><font color="#3A3966">Else</font></b>
    <b><font color="#3A3966">Debug</font></b> &quot;Failed&quot;
  <b><font color="#3A3966">EndIf</font></b>
</font></pre>

</blockquote><p><b>See Also</b></p><blockquote>

<a href="gethttpheader.html">GetHTTPHeader()</a>, <a href="urlencoder.html">URLEncoder()</a> 

</Blockquote><p><b>Supported OS </b><Blockquote>All</Blockquote></p><center><- <a href=httpprogress.html>HTTPProgress()</a> - <a href="index.html">Http Index</a> - <a href="receivehttpmemory.html">ReceiveHTTPMemory()</a> -><br><br>

</body></html>